1. Field of Invention
The present invention relates to data communication systems and more particularly to collision detection in such systems.
2. Related Art
Certain data communication systems have nodes or devices which exchange information with each other via an asynchronous data bus or wire connecting the nodes. A node can be an electronic circuit that has the ability to generate and encode information and place that information on the data bus, and to also receive and decode information placed on the data bus by another node. Nodes may be classified as either master or slave nodes, and master nodes can be either active or inactive. Active master nodes can transmit a message absent a request from another node for the message, while inactive master nodes and slave nodes have no capability for communicating with each other and can only transmit information on the data bus upon receiving a request from an active master node.
In typical packet switching systems, numerous nodes are connected to the same communication network and can access the network at the same time. As a result, if two active master nodes are transmitting information onto the data bus at the same time, packet collisions can occur. When a collision of packets is detected, an instruction is sent to retransmit the original data so that another attempt may be made to receive the packet without a collision. If a collision of packets is not detected, the information transmitted is lost since the signal received is unintelligible, as it is the sum of overlapping packets.
Numerous techniques are known in the art for preventing or detecting data or packet collisions. In some systems, data transmission from a device or node A to a device or node B is effected through two separate wires, one wire for transmission of data from A to B and one wire for transmission from B to A. By using two separate unidirectional wires for data transmission, data packet collision is prevented. A global clock can be used to start and stop data transmissions. Utilizing such a technique, however, can increase the complexity and size of the system as the number of nodes in the system increases. As a result, the number of transmission wires needed so that each node can communicate with every other node can quickly increase to an impractical number.
Other systems may use a single bidirectional wire for data transmission from both A to B and from B to A. In order to prevent collisions, a separate control wire is used to control which device is to write to the bus. The control wire is also used to synchronize the master and the slave. Again, as the number of nodes increases, the number of wires and complexity to the communication system can become impractical.
Still other communication systems may use collision detection methods to determine whether a collision has occurred. For example, a collision is detected when a detection threshold has been exceeded on the data bus, which typically requires setting a precise detection threshold. When a collision is detected, all nodes cease transmission onto the data bus. Ordinarily these techniques are implemented at each node that is transmitting a data packet. Known collision detection methods for bus topology networks compare the data being transmitted with data being simultaneously received at the transmitting node and report collisions when a mismatch is detected. These types of systems may also require multiple node connections, which can quickly become very large as the number of nodes increases.
Accordingly, a communication system with collision detection is desired which overcomes the deficiencies discussed above with conventional collision detection systems.
The present invention provides a structure and method for detecting data packet collisions between two devices by sensing current changes on a single wire interface between two or more devices and then synchronizing the devices after a collision detection. Without a need for a separate control wire, large multi-node systems can be more easily configured. Furthermore, by sensing current changes, precise detection thresholds do not need to be set.
According to the present invention, two nodes A and B transmit data on a single bidirectional line. Assume node A is writing to a data bus, and node B is not transmitting, i.e., listening. If node B wishes to obtain control of the data bus, node B transmits a special data packet to ensure that a collision occurs, i.e., that the data packet being written by node A has at least one bit different in the data stream than the data packet transmitted by node B. When this difference is encountered, an increased amount of current will flow in the single wire because one node will be trying to pull the wire high while another node will be trying to pull the wire low. This current increase is sensed in node A, causing node A to immediately halt data transmission and revert to a listening mode, i.e., reading the output of node B. When node A reads a specific output from node B indicating that node B has ended transmission of the special data packet, nodes A and B are synchronized. Thus, the special data packet contains a bit pattern to ensure a collision detection followed by a bit pattern to indicate the end of the special packet transmission, thereby synchronizing the two nodes. As a result, collision detection and node synchronization can be achieved with a single wire interface, without the need for separate control wires or precise detection thresholds.
According to one embodiment of the present invention, the data packet transmitted by node A consists of at least three consecutive bits of the same type. When the other node B wishes to assert control of the data bus, node B transmits a special data packet having alternating 1""s and 0""s and ending with two consecutive 1""s. Because the bit stream transmitted by node A has at least three consecutive same-type bits, there will be at least one position in the bit stream where the bits transmitted by node A differ from the bits transmitted by node B, thereby ensuring a collision. The presence of a collision on the wire results in a large current on the wire, while no collision results in little or no current on the wire (after a short discharging period). If node A still senses excess current on the wire after a specified time period, a collision is detected. The excess current, which is typically large, can be defined as an amount of current in excess of the amount of current on the wire when no collision is present. Therefore, as long as a large current is sensed, a collision can be detected. Consequently, no precise detection thresholds have to be set to detect collisions on the wire. If a collision is detected, node A stops transmitting data and reads the remaining bits transmitted onto the wire by node B. Once node A encounters two consecutive xe2x80x981xe2x80x99s, node A knows that node B has stopped transmission of the special packet and that the next data packet will consist of information intended for node A, thereby synchronizing the two nodes.
The present invention will be more fully understood in light of the following detailed description taken together with the accompanying drawings.